//
//  CustomTableViewCell.m
//  Ui_13_HomeWork_网易新闻
//
//  Created by Bodi on 16/6/22.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CustomTableViewCell.h"
#import "Model.h"
#import "GetHeightTools.h"
@interface CustomTableViewCell()
@property (nonatomic, retain) UILabel *lable;
@property (nonatomic, retain) UIImageView *BodiImageView;
@end
@implementation CustomTableViewCell
- (void)dealloc
{
    [_lable release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        self.lable = [[UILabel alloc] init];
        [self.contentView addSubview:self.lable];
        [_lable release];
        self.BodiImageView = [[UIImageView alloc]init];
        [self.contentView addSubview:self.BodiImageView];
        [_BodiImageView release];
        
    }
    
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    CGFloat height = [GetHeightTools heightWith:self.model.digest];
    
    self.lable.frame = CGRectMake(0, 20, self.contentView.bounds.size.width, height );
    
    //设置lable的行数为无限行
    self.lable.numberOfLines = 0;
//    CGFloat height1 = [GetHeightTools imageHeightWith:self.model.img];
//    self.BodiImageView.frame = CGRectMake(0, 20, self.contentView.bounds.size.width, height1 / 2);
//    self.BodiImageView.backgroundColor = [UIColor greenColor];
    
    
}

- (void)setModel:(Model *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    
    self.lable.text = model.digest;
    
    
    
}


@end
